﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameBase;

namespace GalaxyPresident
{
    public class UniveralObject : InvisibleGameEntity
    {
        protected float _diameter;

        public float Diameter
        {
            get { return _diameter; }
            set { _diameter = value; }
        }
        protected Orbit _orbit;
        protected float _velocity;
        protected Vector2 position;

        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }
        protected Color backColor;

        public Color BackColor
        {
            get { return backColor; }
            set { backColor = value; }
        }

        public Orbit OrbitPlanet
        {
            get { return _orbit; }
            set { _orbit = value; }
        }

        public UniveralObject(string strImage, float diameter, float velocity, Orbit orbit)
        {
            _orbit = orbit;
            _velocity = velocity;

            interalInit(strImage, diameter);
        }

        protected void interalInit(string strImage, float diameterz)
        {
            Diameter = diameterz;
           
            BackColor = Constant.starColors[Constant.random.Next(Constant.starColors.Length)];
            BackColor = Color.Lerp(BackColor, Color.DodgerBlue, 0.2f);  
        }

        public override void UpdateInfo(GameTime gameTime)
        {
            base.UpdateInfo(gameTime);

            _currentTotalTime += _velocity;

            if (_orbit != null)
            {
                Position = _orbit.getPositionAtAngle(_currentTotalTime);
            }
        }
    }
}
